Rails.application.routes.draw do
  
  root 'home#index'
  
   get '/send_file'=>'home#send_file'

  devise_for :users, path: "admins/users", controllers: {
    sessions: "sessions"
  }
  get  '/call_xxzy_xyyw_2013.php'=>"out_to_news#call_xxzy_xyyw_2013"
  get  '/call_xxzy_xykx_2013.php'=>"out_to_news#call_xxzy_xykx_2013"
  get  '/call_xxzy_tzgg_2013.php'=>"out_to_news#call_xxzy_tzgg_2013"
  get  '/call_xxzy_tzgg_2.php'=>"out_to_news#call_xxzy_tzgg_2"
  get  '/call_xxzy_jzbg_2013.php'=>"out_to_news#call_xxzy_jzbg_2013"
  get  '/call_xxzy_mthl_2013.php'=>"out_to_news#call_xxzy_mthl_2013"


  resources :out_to_news do
    collection do
    end
  end
  get '/mobile/' => 'mobile/home#index'
  namespace :mobile do
    resources :news, only:[:index,:show]
    resources :notifies, only:[:index,:show]
    resources :reports, only:[:index,:show]
    resources :new_medias do
      collection do
        get :mobile_weixin,:hualli_app
      end
    end
  end

  namespace :admins do     
    resources :news do
      get :approve_detail,on: :member
      get :get_second_categories,on: :collection
      post :reject,on: :member
      collection do
        post :upload_json
      end
      member do
        get :confirm_check
        post :change_time
        post :change_hits
        get :change_enable
        get :writer
      end

    end
    resources :meitis do
      member do
        get :submit
        post :change_time
      end
    end
    resources :sptitles
    resources :dangans do
      get :guidang ,on: :collection
  end
  resources :jifens do
      get :about ,on: :collection
  end
    
    resources :jifengerens
    resources :new_media
    resources :top_news
    resources :clues do
      member do
        get :submit
        get :approve
        post :reject
      end
    end
    resources :reports do
      member do
        get :submit
        get :approve
        post :reject
        post :change_time
      end
    end
    resources :weibos do
      member do
        get :submit
        get :approve
        post :reject
      end
    end
    resources :weixins do
      member do
        get :submit
        get :approve
        post :reject
      end
    end
    resources :notifies do
      member do
        get :submit
        get :approve
        post :reject
        post :change_time
      end
    end

    resources :groups do 
      member do 
        get :permissions
      end
    end
    
    resources :attachments do
      collection do
        post :upload
      end
    end
    
    resources :accounts, except: [:index] do 
      member do 
        put :update_password
      end 
    end
    resources :departments
    resources :notifies       
    resources :categories
    resources :view_articles do
      member do
        put :up_index
        put :down_index
        put :del_index
      end
    end
  end

  resources :sptitles

  resources :admins, only: [:index]

  get '/news/important_news' => 'news#important_news'
  get '/news/general_news' => 'news#general_news'
  get '/news/recruit' => 'news#job'
  get '/news/communication' => 'news#join_exchange'
  get '/news/distance' => 'news#distance'
  get '/news/ecust_picture' => 'news#picture_hl'
  get '/news/voide_hl' => 'news#voide_hl'
  get '/news/important_messages' => 'news#important_messages'
  get '/new_media/qrcode' => 'new_media#qrcode'
  get '/new_media/weiquan' => 'new_media#weiquan'
  get '/new_media/ihuali' => 'new_media#ihuali'
  
  resources :news, only:[:index,:show]
  resources :notifies
  resources :new_media
  resources :reports
  resources :sptitles
  resources :search, only: [:index] do 
    collection do 
      get :advanced, :to => "search#advanced"
    end
  end
  resources :categories, only: [] do
    member do 
      get :childrens, :to => "categories#childrens"
    end 
  end  

  get '/admins/news/:id/submit' => 'admins/news#submit'
  get '/admins/news/:id/approve' => 'admins/news#approve'
  #get '/admins/news/:id/reject' => 'admins/news#reject'

end
